/*
 * @Author: your name
 * @Date: 2021-11-25 16:54:22
 * @LastEditTime: 2021-11-26 16:45:57
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /vite-project/src/components/Lazy/index.js
 */
import React, {Component} from 'react'

const Lazy = (Element) => {
    return class extends Component {
        state = {
            Com: null
        }
        componentDidMount() {
            Element().then(res => {
                console.log(res)
                this.setState({
                    Com: res.default
                })
            })
        }
        render () {
            let {Com} = this.state
            return (
                Com ? <Com></Com> : null
            )
            // <Element {...this.props}></Element>
        }
    }
}

export default Lazy;